package org.jash.shop2112.utils

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import androidx.databinding.InverseBindingAdapter
import com.bumptech.glide.Glide
import com.youth.banner.Banner

@BindingAdapter(value = ["android:image_url", "android:circle"], requireAll = false)
fun imageLoad(image:ImageView, url: String?, circle:Boolean = false) {
    Glide.with(image)
        .load(url)
        .apply {
            if (circle) {
                circleCrop()
            }
        }
        .into(image)
}
@BindingAdapter("android:banner_list")
fun bannerList(banner:Banner, list:List<String>?) {
    list?.let { banner.update(it) }
}